﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace WebNhaXuatBan
{
    public partial class DatMua : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            ArrayList list = new ArrayList();
            if (Session["GioHang"] != null)
            {
                list = (ArrayList)Session["GioHang"];
            }
            try
            {
                int soLuong = int.Parse(TextBox1.Text);
                DTO.ChiTietGioHangDTO chitiet = new DTO.ChiTietGioHangDTO();
                chitiet.SoLuong = soLuong;
                chitiet.MaSach = int.Parse(Request.QueryString["MaSach"]);
                list.Add(chitiet);
                Session["GioHang"] = list;
            }
            catch (Exception ex)
            {
                int masach = int.Parse(Request.QueryString["MaSach"]);
                Response.Redirect("DatMua.aspx?MaSach=" + masach);
                return;
            }
            Response.Redirect("GianHangSach.aspx");
        }
    }
}